package com.liu.sx.dao;

import com.liu.sx.entity.Driver;
import com.liu.sx.entity.Worm;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface DriverDao extends JpaRepository<Driver,String> , JpaSpecificationExecutor<Driver> {

        Driver findByAddress(String address );
        Page<Driver> findByAddress(String address , Pageable pageable);

        @Query(value = "select t from Driver  t where t.address like concat('%',:query,'%') ")
        Page<Driver> findAll(String query ,Pageable pageable);


        List<Driver> findByUserId(int userId);

}
